
package com.joysuch.wwyt.edu.enums;

/**
 * 提醒类型
 *
 * @author eric
 */
public enum CertificateNotifyType {

    /**
     * 有效期到期提醒
     */
    YOU_XIAO_QI(0, "有效期到期提醒"),
    /**
     * 复证到期提醒
     */
    FU_ZHENG_DAO_QI(1, "复证到期提醒");

    private int id;
    private String name;

    private CertificateNotifyType(int id, String name) {
        this.id = id;
        this.name = name;
    }

    public int getId() {
        return id;
    }

    public String getName() {
        return name;
    }

    public static CertificateNotifyType findByName(String name) {
        CertificateNotifyType[] values = CertificateNotifyType.values();
        for (CertificateNotifyType v : values) {
            if (v.getName().equals(name)) {
                return v;
            }
        }
        return null;
    }

    public static CertificateNotifyType findById(Integer level) {
        CertificateNotifyType[] values = CertificateNotifyType.values();
        for (CertificateNotifyType v : values) {
            if (v.getId() == level) {
                return v;
            }
        }
        return null;
    }

    public static String findNameById(Integer id) {
        if (id == null) {
            return null;
        }
        CertificateNotifyType[] values = CertificateNotifyType.values();
        for (CertificateNotifyType v : values) {
            if (v.getId() == id) {
                return v.getName();
            }
        }
        return null;
    }
}
